<template>
	<view>
		<u-navbar :title="id ? '编辑乘车人' : '新增乘车人'" :background="{background: 'transparent'}" back-icon-color="#000"
		 title-color="#000" :border-bottom="false">
			<view slot="right" @click="saveBtn" style="margin-right: 40rpx;">保存</view>
		</u-navbar>
		<u-form style="padding: 0 40rpx;">
			<u-form-item label="姓名" label-width="150">
				<u-input v-model="name" placeholder="与证件姓名一致" />
			</u-form-item>
			<u-form-item label="手机号码" label-width="150">
				<u-input v-model="mobile" placeholder="用于接收短信" />
			</u-form-item>
		</u-form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: '',
				mobile: '',
				id: ''
			};
		},
		onLoad(options) {
			this.id = Number(options.id) || ''
		},
		methods: {
			saveBtn() {
				if (this.id) {
					this.edit()
				} else {
					this.save()
				}
			},
			save() {
				uni.showToast({
					title: '新增'
				})
				setTimeout(uni.navigateBack, 2000)
			},
			edit() {
				uni.showToast({
					title: '编辑'
				})
				setTimeout(uni.navigateBack, 2000)
			}
		}
	}
</script>
<style>
	page {
		background-color: #FFFFFF;
	}
</style>
<style lang="scss">

</style>
